<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <script type="text/javascript">
	    var path = window.document.location.href;
		var pathName = window.document.location.pathname;
		var hostPath = path.substring(0, path.indexOf(pathName));
		var projectName = pathName.substring(0, pathName.substr(1).indexOf("/") + 1);
		document.write('<scr' + 'ipt src="' + projectName + '/js/html/header.js"></scr'+'ipt>');
    </script>
</head>
<body>
	<table id="dg" style="width: auto; height: auto" fitColumns="true">
		<thead>
			<tr>
			<th field="serialno" align="right" width="100" 
				data-options="
				sortable:true,
				remoteSort:false
				">流水号</th>
			<th field="duebillno" align="right" width="100" 
				data-options="
				sortable:true,
				remoteSort:false
				">借据号</th>
			<th field="occurdate" align="right" width="80" 
				data-options="
				sortable:true,
				remoteSort:false
				">交易日期</th>
			<th field="businesssum" align="right" width="60" 
				data-options="
				sortable:true,
				remoteSort:false
				">交易金额</th>
			<th field="orgid" align="right" width="60" 
				data-options="
				sortable:true,
				remoteSort:false
				">机构号</th>
			<th field="kshchpdm" align="right" width="100" 
				data-options="
				sortable:true,
				remoteSort:false
				">可售产品代码</th>
			<th field="kshchpmc" align="right" width="100" 
				data-options="
				sortable:true,
				remoteSort:false
				">可售产品名称</th>
			<th field="status" align="right" width="60" 
				data-options="
				sortable:true,
				remoteSort:false
				">处理状态</th>
			<th field="channelno" align="right" width="40" 
				data-options="
				sortable:true,
				remoteSort:false
				">渠道</th>
			<th field="batchFlag" align="right" width="100" 
				data-options="
				sortable:true,
				remoteSort:false
				">批次号</th>
			<th field="remark" align="right" width="100" 
				data-options="
				sortable:true,
				remoteSort:false
				">备注</th>
			</tr>
		</thead>
	</table>
	<div id="dg-buttons" style="height: auto">
		<div style="margin-bottom:5px">
			<a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true" 	onclick="dlgAdd()">新增</a>
			<a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-remove',plain:true" 	onclick="dlgRemove()">删除</a>
			<a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-edit',plain:true" 	onclick="dlgEdit()">修改</a>
		</div>
		<div>
			<span>&nbsp;&nbsp;&nbsp;&nbsp;选择:</span>
			<input type="text" id="searchKey" name="searchKey" class="easyui-combobox" />
			<span>等于:</span>
			<input type="text" id="searchValue" name="searchValue" class="easyui-validatebox" />
			<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-search" onclick="dgop.find()">查询</a>
		</div>
	</div>
<div id="dlg-buttons">
		<a href="javascript:dlgSave()" class="easyui-linkbutton" iconCls="icon-ok">保存</a>
		<a href="javascript:dlgClose()" class="easyui-linkbutton" iconCls="icon-cancel">关闭</a>
	</div>
	<div id="dlg" class="easyui-dialog" closed="true" style="width: 730px; height: 380px; padding: 10px 10px;" buttons="#dlg-buttons">
		<form method="post" id="fm">
			<table cellspacing="8px;">
				<td><input id="id" name="id" style="display: none" required="true"></td>
			<tr>
				<td>流水号</td>
				<td><input id="serialno" name="serialno" class="easyui-validatebox" 
				required="true">&nbsp; 
				<span style="color: red">*</span></td>
			</tr>
			<tr>
				<td>借据号</td>
				<td><input id="duebillno" name="duebillno" class="easyui-validatebox" 
				required="true">&nbsp; 
				<span style="color: red">*</span></td>
			</tr>
			<tr>
				<td>交易日期</td>
				<td><input id="occurdate" name="occurdate" class="easyui-validatebox" 
				required="true">&nbsp; 
				<span style="color: red">*</span></td>
			</tr>
			<tr>
				<td>交易金额</td>
				<td><input id="businesssum" name="businesssum" class="easyui-validatebox" 
				required="true">&nbsp; 
				<span style="color: red">*</span></td>
			</tr>
			<tr>
				<td>机构号</td>
				<td><input id="orgid" name="orgid" class="easyui-validatebox" 
				required="true">&nbsp; 
				<span style="color: red">*</span></td>
			</tr>
			<tr>
				<td>可售产品代码</td>
				<td><input id="kshchpdm" name="kshchpdm" class="easyui-validatebox" 
				required="true">&nbsp; 
				<span style="color: red">*</span></td>
			</tr>
			<tr>
				<td>可售产品名称</td>
				<td><input id="kshchpmc" name="kshchpmc" class="easyui-validatebox" 
				required="true">&nbsp; 
				<span style="color: red">*</span></td>
			</tr>
			<tr>
				<td>处理状态</td>
				<td><input id="status" name="status" class="easyui-combobox" 
				required="true">&nbsp; 
				<span style="color: red">*</span></td>
			</tr>
			<tr>
				<td>渠道</td>
				<td><input id="channelno" name="channelno" class="easyui-validatebox" 
				required="true">&nbsp; 
				<span style="color: red">*</span></td>
			</tr>
			<tr>
				<td>批次号</td>
				<td><input id="batchFlag" name="batchFlag" class="easyui-validatebox" 
				required="true">&nbsp; 
				<span style="color: red">*</span></td>
			</tr>
			<tr>
				<td>备注</td>
				<td><input id="remark" name="remark" class="easyui-validatebox" > 
			</tr>
			</table>
		</form>
	</div>
	<div id="dlg-Details" class="easyui-window" closed="true" style="width: 730px; height: 280px; padding: 10px 10px;"></div>
	<script>
		var initd = {
			queryDataURL : "/businessExtend/wastebookQuery",
			saveDataURL : "/businessExtend/wastebookSave",
			removeDataURL:"/businessExtend/wastebookRemove",
			dg : $('#dg'),
			dataDicLocal:{'status':{'00':'未处理','01':'处理中','02':'处理成功'}}//需加载的 DATADIC 字典名+作用的字段名
		};
		
		function dlgRemove() {
		    var selectedRows = $("#dg").datagrid("getSelections");
		    if (selectedRows.length == 0) {
		        $.messager.alert("系统提示", "请选择要删除的数据！");
		        return;
		    }
		    var strIds = [];
		    for ( var i = 0; i < selectedRows.length; i++) {
		        strIds.push(selectedRows[i].serialno);
		    }
		    var ids = strIds.join(",");
		    $.messager.confirm("系统提示", "您确定要删除这<font color=red>" + selectedRows.length + "</font>条数据吗？", function(r) {
		        if (r) {
		        	$.ajax({
		        		type:"POST",
		        		dataType:"json",
		        		url :initd.removeDataURL,
		        		data:{serialno : ids},
		        		beforeSend : function() {
		                },
		        		success : function(result) {
		        			if (result.success) {
			                    $.messager.alert("系统提示", "数据已成功删除！");
			                    $("#dg").datagrid("reload");
			                } else {
			                	if(!jQuery.isEmptyObject(result.message)){
			                		$.messager.alert("系统错误", result.message);
			                	}else{
			                		$.messager.alert("系统错误", result);
			                	}
			                    return;
			                }
		                },
		        		error:function(err, status){
		        			errorMsgAlert(err);
		        			$.messager.progress("close");
		        		}
		        	});

		        }
		    });
		}
	</script>
</body>
</html>

